<template>
  <a-select
      v-model:value="val"
      :disabled="disabled"
      :options="store.getters.dict[code]"
      :field-names="{label:'itemText',value:'itemValue'}"
  />
</template>

<script lang="ts" setup>
import { computed } from 'vue'
import { useStore } from '@/store/store'

const store = useStore()

const props = defineProps({
  modelValue: String,
  code: String,
  disabled: Boolean
})

const val = computed({
  set: val => emits('update:modelValue', val),
  get: () => props.modelValue
})

store.dispatch('LoadDictData', [props.code])
const emits = defineEmits(['update:modelValue'])

</script>

<style scoped>

</style>
